#if !defined(AFX_FLATBUTTONDEMODLG_H__6BD2EF46_4310_11D3_ABAD_84F100C10000__INCLUDED_)
#define AFX_FLATBUTTONDEMODLG_H__6BD2EF46_4310_11D3_ABAD_84F100C10000__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "ButtonGrp.h"
#include "CfgList.h"

typedef struct {
	LVITEM* plvi;
	CString sCol2;
} lvItem, *plvItem;

const int FECOL_NAME=0;
const int FECOL_TYPE=1;
const int FECOL_STARTBYTE=2;
const int FECOL_STARTBIT=3;
const int FECOL_LENGTH=4;
const int FECOL_EXPRESSION=5;
const int FECOL_STATES=6;
const int FECOL_BE=7;
const int FECOL_MEMO=8;
const int FECOL_GRAPH=9;
const int FECOL_MIN=10;
const int FECOL_MAX=11;
const int FECOL_TINT=12;
const int FECOL_OPEN=13;

/////////////////////////////////////////////////////////////////////////////
// CFlatEditDlg dialog
class CFlatEditDlg : public CDialog
{
// Construction
public:
	CFlatEditDlg(CWnd* pParent = NULL);	// standard constructor
    CString FE_file;
    bool    FE_fix;

// Dialog Data
	//{{AFX_DATA(CFlatEditDlg)
	enum { IDD = IDD_FLATEDIT_DIALOG };
	CButtonGrp	m_ButtonGrp;
	CCfgList	m_ListCtrl;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFlatEditDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	int        FE_cols;
    HSM_ITEM    FE_cfg[124];
	
	CImageList* m_pDragImage;	//For creating and managing the drag-image
	HICON       m_hIcon;

	int	     	m_nDragIndex;	//Index of selected item in the List we are dragging FROM
	BOOL		m_bDragged;	//T during a drag operation
	int			m_nDropIndex;	//Index at which to drop item in the List we are dropping ON

	CListCtrl  *m_pDragList;		//Which ListCtrl we are dragging FROM
	CListCtrl  *m_pDropList;		//Which ListCtrl we are dropping ON
	CWnd*		m_pDropWnd;		//Pointer to window we are dropping on (will be cast to CListCtrl* type)

	void   BuildList();
    void   DoOpenNotify();
	void   RecordProfile(CString &feFile);
	void   WriteXmlConfig(CString &feFile);

	// Generated message map functions
	//{{AFX_MSG(CFlatEditDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnAddrow();
	afx_msg void OnDelrow();
	afx_msg void OnPpSelectall();
	afx_msg void OnPpClearall();
	afx_msg void OnBegindragListVwitem(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	//}}AFX_MSG
	afx_msg LRESULT OnImportNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnOpenNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnCloseNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnSaveNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnSaveAsNotify(WPARAM wParam, LPARAM lParam);
    afx_msg void OnCustomdrawList(NMHDR*, LRESULT*);
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FLATBUTTONDEMODLG_H__6BD2EF46_4310_11D3_ABAD_84F100C10000__INCLUDED_)
